home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Tool Chest / Development Tools & Languages / Dylan Related / Mindy / Mindy 1.2 - portable sources / configure.in < prev    next >
Encoding:
Text File  |  1995-03-15  |  12.3 KB  |  368 lines  |  [TEXT/ttxt]

  1. dnl
  2. dnl    This file is an input file used by the GNU "autoconf" program
  3. dnl    to generate the file "configure", which is run during mindy
  4. dnl    installation to configure the system for the local
  5. dnl    environment. 
  6. dnl
  7. dnl    The dnl m4 macro discards the rest of the line as a comment.
  8. dnl
  9. dnl    Pound sign comments get copied into configure, which
  10. dnl    will be a normal shell script.
  11. dnl
  12. dnl    This macro determines whether the source root is the current
  13. dnl    directory or the parent of the current directory.  If you make
  14. dnl    a subdirectory of the source root, then configure will build a
  15. dnl    directory tree suitable for making mindy.
  16. dnl
  17. dnl    This must come first -- do not move.
  18.  
  19. AC_INIT(interp/mindy.h)
  20.  
  21. #--------------------------------------------------------------------
  22. #    See if the #!interpreter syntax is supported
  23. #--------------------------------------------------------------------
  24.  
  25. AC_HAVE_POUNDBANG(,AC_DEFINE(NO_SHARP_BANG))
  26.  
  27. #--------------------------------------------------------------------
  28. #    These macros find a BSD install, a C compiler, and so on, and
  29. #    establish bindings for @INSTALL@, @CC@, and so on.
  30. #--------------------------------------------------------------------
  31.  
  32. AC_PROG_INSTALL
  33. AC_PROG_CC
  34. AC_PROG_LEX
  35. YACC=${YACC-yacc}
  36. AC_SUBST(YACC)dnl
  37. AC_PROG_RANLIB
  38.  
  39. #--------------------------------------------------------------------
  40. #    Establish the default compile options for cc
  41. #--------------------------------------------------------------------
  42.  
  43. if test $CC = gcc
  44. then CCOPTS="-g -O4 -finline-functions -Wall"
  45. else CCOPTS="-g -O"
  46. fi
  47. AC_SUBST(CCOPTS)dnl
  48.  
  49. #--------------------------------------------------------------------
  50. #    Establish the default options for lex
  51. #--------------------------------------------------------------------
  52.  
  53. if test $LEX = flex; then
  54.   LFLAGS=${LFLAGS--i}
  55. else
  56.   echo "I could not find flex, so do not try to rebuild comp/lexer.tab.c"
  57.   echo "because lex cannot do it."
  58.   LFLAGS=${LFLAGS-}
  59. fi
  60. AC_SUBST(LFLAGS)
  61.  
  62. #--------------------------------------------------------------------
  63. #    Find out if sigaction is available.
  64. #--------------------------------------------------------------------
  65.  
  66. AC_FUNC_CHECK(sigaction, sigaction=1, sigaction=0)
  67. if test $sigaction = 0; then
  68.   AC_DEFINE(NO_SIGACTION)
  69.   LIBOBJS="${LIBOBJS-} sigaction.o"
  70.   AC_FUNC_CHECK(sigsetmask, sigsetmask=1, sigsetmask=0)
  71.   AC_FUNC_CHECK(sigrelse, sigrelse=1, sigrelse=0)
  72.   if test $sigsetmask = 1; then
  73.     echo "BSD_signals"
  74.     AC_DEFINE(BSD_SIGNALS)
  75.   elif test $sigrelse = 1; then
  76.     echo "USG_signals"
  77.     AC_DEFINE(USG_SIGNALS)
  78.   else
  79.     echo "I couldn't find posix, bsd, or sysV signal support."
  80.     echo "You may be able to compile compat/sigaction.c by hand."
  81.   fi
  82. fi
  83.  
  84. #--------------------------------------------------------------------
  85. #    This next section is lifted from tcl-7.3, it deals with
  86. #    establishing which of the known faults in POSIX compliance
  87. #    need to be corrected.
  88. #--------------------------------------------------------------------
  89.  
  90. #--------------------------------------------------------------------
  91. #    Supply substitutes for missing POSIX library procedures, or
  92. #    set flags so Tcl uses alternate procedures.
  93. #--------------------------------------------------------------------
  94.  
  95. AC_REPLACE_FUNCS(getcwd opendir strerror strstr)
  96. AC_REPLACE_FUNCS(strtol memmove tmpnam waitpid)
  97. AC_FUNC_CHECK(gettimeofday, , AC_DEFINE(NO_GETTOD))
  98. AC_FUNC_CHECK(getwd, , AC_DEFINE(NO_GETWD))
  99. AC_FUNC_CHECK(wait3, , AC_DEFINE(NO_WAIT3))
  100.  
  101. #--------------------------------------------------------------------
  102. #    Supply substitutes for missing POSIX header files.  Special
  103. #    notes:
  104. #        - Sprite's dirent.h exists but is bogus.
  105. #        - stdlib.h doesn't define strtol, strtoul, or
  106. #          strtod insome versions of SunOS
  107. #        - some versions of string.h don't declare procedures such
  108. #          as strstr
  109. #--------------------------------------------------------------------
  110.  
  111. AC_HEADER_CHECK(unistd.h, , AC_DEFINE(NO_UNISTD_H))
  112. AC_COMPILE_CHECK(dirent.h, [#include <sys/types.h>
  113. #include <dirent.h>], [
  114. DIR *d;
  115. struct dirent *entryPtr;
  116. char *p;
  117. d = opendir("foobar");
  118. entryPtr = readdir(d);
  119. p = entryPtr->d_name;
  120. closedir(d);
  121. ], tcl_ok=1, tcl_ok=0)
  122. AC_HEADER_EGREP([Sprite version.* NOT POSIX], dirent.h, tcl_ok=0)
  123. if test $tcl_ok = 0; then
  124.     AC_DEFINE(NO_DIRENT_H)
  125. fi
  126. AC_HEADER_CHECK(errno.h, , AC_DEFINE(NO_ERRNO_H))
  127. AC_HEADER_CHECK(float.h, , AC_DEFINE(NO_FLOAT_H))
  128. AC_HEADER_CHECK(limits.h, , AC_DEFINE(NO_LIMITS_H))
  129. AC_HEADER_CHECK(bstring.h, , AC_DEFINE(NO_BSTRING_H))
  130. AC_HEADER_CHECK(stdlib.h, tcl_ok=1, tcl_ok=0)
  131. AC_HEADER_EGREP(getenv, stdlib.h, , tcl_ok=0)
  132. AC_HEADER_EGREP(strtol, stdlib.h, , tcl_ok=0)
  133. AC_HEADER_EGREP(strtoul, stdlib.h, , tcl_ok=0)
  134. AC_HEADER_EGREP(strtod, stdlib.h, , tcl_ok=0)
  135. if test $tcl_ok = 0; then
  136.     AC_DEFINE(NO_STDLIB_H)
  137. fi
  138. AC_HEADER_CHECK(string.h, tcl_ok=1, tcl_ok=0)
  139. AC_HEADER_EGREP(strstr, string.h, , tcl_ok=0)
  140. AC_HEADER_EGREP(strerror, string.h, , tcl_ok=0)
  141. if test $tcl_ok = 0; then
  142.     AC_DEFINE(NO_STRING_H)
  143. fi
  144. AC_HEADER_CHECK(sys/time.h, , AC_DEFINE(NO_SYS_TIME_H))
  145. AC_HEADER_CHECK(sys/wait.h, , AC_DEFINE(NO_SYS_WAIT_H))
  146.  
  147. #--------------------------------------------------------------------
  148. #    Include sys/select.h if it exists and if it supplies things
  149. #    that appear to be useful and aren't already in sys/types.h.
  150. #    This appears to be true only on the RS/6000 under AIX.  Some
  151. #    systems like OSF/1 have a sys/select.h that's of no use, and
  152. #    other systems like SCO UNIX have a sys/select.h that's
  153. #    pernicious.  If "fd_set" isn't defined anywhere then set a
  154. #    special flag.
  155. #--------------------------------------------------------------------
  156.  
  157. echo checking for sys/select.h
  158. AC_COMPILE_CHECK(fd_set, [#include <sys/types.h>],
  159.     [fd_set readMask, writeMask;], ,
  160.     AC_HEADER_EGREP(fd_mask, sys/select.h, AC_DEFINE(HAVE_SYS_SELECT_H),
  161.         AC_DEFINE(NO_FD_SET)))
  162.  
  163. # On the HP, select is defined in sys/time.h
  164. #
  165. AC_HEADER_EGREP(select, sys/time.h, AC_DEFINE(SELECT_IN_TIME_H))
  166.  
  167.  
  168. #--------------------------------------------------------------------
  169. #    On some systems strstr is broken: it returns a pointer even
  170. #    even if the original string is empty.
  171. #--------------------------------------------------------------------
  172.  
  173. AC_TEST_PROGRAM([
  174. extern int strstr();
  175. int main()
  176. {
  177.     exit(strstr("\0test", "test") ? 1 : 0);
  178. }
  179. ],  , [LIBOBJS="${LIBOBJS-} strstr.o"])
  180.  
  181. #--------------------------------------------------------------------
  182. #    Check for strtoul function.  This is tricky because under some
  183. #    versions of AIX strtoul returns an incorrect terminator
  184. #    pointer for the string "0".
  185. #--------------------------------------------------------------------
  186.  
  187. AC_FUNC_CHECK(strtoul, tcl_ok=1, tcl_ok=0)
  188. AC_TEST_PROGRAM([
  189. extern int strtoul();
  190. int main()
  191. {
  192.     char *string = "0";
  193.     char *term;
  194.     int value;
  195.     value = strtoul(string, &term, 0);
  196.     if ((value != 0) || (term != (string+1))) {
  197.         exit(1);
  198.     }
  199.     exit(0);
  200. }], , tcl_ok=0)
  201. if test $tcl_ok = 0; then
  202.     LIBOBJS="${LIBOBJS-} strtoul.o"
  203. fi
  204.  
  205. #--------------------------------------------------------------------
  206. #    Check for the strtod function.  This is tricky because under
  207. #    some versions of Linux it mis-parses the string "+".
  208. #--------------------------------------------------------------------
  209.  
  210. AC_FUNC_CHECK(strtod, tcl_ok=1, tcl_ok=0)
  211. AC_TEST_PROGRAM([
  212. extern double strtod();
  213. int main()
  214. {
  215.     char *string = "+";
  216.     char *term;
  217.     double value;
  218.     value = strtod(string, &term);
  219.     if (term != string) {
  220.     exit(1);
  221.     }
  222.     exit(0);
  223. }], , tcl_ok=0)
  224. if test $tcl_ok = 0; then
  225.     LIBOBJS="${LIBOBJS-} strtod.o"
  226. fi
  227.  
  228. #--------------------------------------------------------------------
  229. #    Check for various typedefs and provide substitutes if
  230. #    they don't exist.
  231. #--------------------------------------------------------------------
  232.  
  233. AC_MODE_T
  234. AC_PID_T
  235. AC_SIZE_T
  236. AC_UID_T
  237.  
  238. #--------------------------------------------------------------------
  239. #    If a system doesn't have an opendir function (man, that's old!)
  240. #    then we have to supply a different version of dirent.h which
  241. #    is compatible with the substitute version of opendir that's
  242. #    provided.  This version only works with V7-style directories.
  243. #--------------------------------------------------------------------
  244.  
  245. AC_FUNC_CHECK(opendir, , AC_DEFINE(USE_DIRENT2_H))
  246.  
  247. #--------------------------------------------------------------------
  248. #    Check for the existence of sys_errlist (this is only needed if
  249. #    there's no strerror, but I don't know how to conditionalize the
  250. #    check).
  251. #--------------------------------------------------------------------
  252.  
  253. AC_COMPILE_CHECK(sys_errlist, , [
  254. extern char *sys_errlist[];
  255. extern int sys_nerr;
  256. sys_errlist[sys_nerr-1][0] = 0;
  257. ], , AC_DEFINE(NO_SYS_ERRLIST))
  258.  
  259. #--------------------------------------------------------------------
  260. #    The check below checks whether <sys/wait.h> defines the type
  261. #    "union wait" correctly.  It's needed because of weirdness in
  262. #    HP-UX where "union wait" is defined in both the BSD and SYS-V
  263. #    environments.  Checking the usability of WIFEXITED seems to do
  264. #    the trick.
  265. #--------------------------------------------------------------------
  266.  
  267. AC_COMPILE_CHECK([union wait], [#include <sys/types.h> 
  268. #include <sys/wait.h>], [
  269. union wait x;
  270. WIFEXITED(x);        /* Generates compiler error if WIFEXITED
  271.              * uses an int. */
  272. ], , AC_DEFINE(NO_UNION_WAIT))
  273.  
  274. #--------------------------------------------------------------------
  275. #    Check to see whether the system supports the matherr function
  276. #    and its associated type "struct exception".
  277. #--------------------------------------------------------------------
  278.  
  279. AC_COMPILE_CHECK([matherr support], [#include <math.h>], [
  280. struct exception x;
  281. x.type = DOMAIN;
  282. x.type = SING;
  283. ], [LIBOBJS="${LIBOBJS-} matherr.o"; AC_DEFINE(NEED_MATHERR)])
  284.  
  285. #--------------------------------------------------------------------
  286. #    End of the section lifted from tcl.
  287. #--------------------------------------------------------------------
  288.  
  289. #--------------------------------------------------------------------
  290. #    Check for rint()
  291. #--------------------------------------------------------------------
  292.  
  293. LIBS="${LIBS-} -lm"
  294. AC_REPLACE_FUNCS(rint)
  295.  
  296. #--------------------------------------------------------------------
  297. #    Check to see whether we know how to read the number of bytes
  298. #    in a stdio buffer.
  299. #--------------------------------------------------------------------
  300.  
  301. AC_COMPILE_CHECK([stdio support], [#include <stdio.h>], [
  302. FILE f;
  303. (f._IO_read_ptr >= f._IO_read_end);
  304. ],AC_DEFINE(USE_LINUX_FBUFEMPTYP))
  305.  
  306. #--------------------------------------------------------------------
  307. #    Check to see if fsync is available.
  308. #--------------------------------------------------------------------
  309.  
  310. AC_FUNC_CHECK(fsync, , AC_DEFINE(NO_FSYNC))
  311.  
  312. #--------------------------------------------------------------------
  313. #    Look for select() in various places.
  314. #    Tk adds all of these libraries that are found.
  315. #    Under Irix 5.2, all three are found, but none should be
  316. #    used.  Go figure.  So I test to see when select() is
  317. #    found and stop adding libraries at that point.
  318. #--------------------------------------------------------------------
  319.  
  320. AC_FUNC_CHECK(select, select=1, select=0)
  321. SAVE_LIBS="$LIBS"
  322. for lib in Xbsd socket nsl; do
  323.   if test $select = 0; then
  324.     AC_HAVE_LIBRARY($lib, tryit=1, tryit=0)
  325.     if test $tryit = 1; then
  326.       LIBS="$LIBS -l$lib"
  327.       AC_FUNC_CHECK(select, select=1, LIBS="$SAVE_LIBS")
  328.     fi
  329.   fi
  330. done
  331. if test $select = 0; then
  332.   echo "I can't find a select() in any library I've looked in,"
  333.   echo "and you won't be able to compile without it.  Sorry."
  334. fi
  335.  
  336. #--------------------------------------------------------------------
  337. #    Finally, output the Makefiles for each part of the
  338. #    distribution.  As a side effect the necessary directories are
  339. #    created, too. 
  340. #
  341. #    In the best of all possible worlds, you would only need to add
  342. #    new files to this list as mindy expands, and create the
  343. #    Makefile.in for each of them;  in this world, however, you'll
  344. #    probably have to mess with the rest of the file, so be warned:
  345. #    autoconf is a very brittle programming language.
  346. #--------------------------------------------------------------------
  347.  
  348. AC_OUTPUT(Makefile \
  349.     comp/Makefile \
  350.     interp/Makefile \
  351.     compat/Makefile \
  352.     etc/Makefile \
  353.     libraries/Makefile \
  354.     libraries/dylan/Makefile \
  355.     libraries/streams/Makefile \
  356.     libraries/print/Makefile \
  357.     libraries/format/Makefile \
  358.     libraries/coll-ext/Makefile \
  359.     libraries/random/Makefile \
  360.     libraries/string-ext/Makefile \
  361.     demos/Makefile \
  362.     demos/hello-world/Makefile \
  363.     demos/cat/Makefile \
  364.     demos/html2txt/Makefile \
  365.     tests/Makefile \
  366. )
  367.  
  368.